<?php


namespace app\api\model;

class Banner extends BaseModel
{
    protected $table = 'banner';
    protected $hidden = ['delete_time'];
    //php think 
    public function items()
    {
        return $this->hasMany('BannerItem', 'banner_id', 'id');
    }

    public static function getBannerByID($id)
    {
        $banner = Banner::with(['items', 'items.img'])->find($id);

        return $banner;
    }
}